package CountDownLatchTest;

import java.util.concurrent.CountDownLatch;

/**
 * Created by dycong on 2017/4/5.
 */
public class Worker1 implements Runnable {
    private CountDownLatch startSignal=null;
    private CountDownLatch doneSignal=null;

    public Worker1(CountDownLatch c1,CountDownLatch c2){
        startSignal=c1;
        doneSignal=c2;
    }
    @Override
    public void run(){
        try {
            System.out.println("runnable start");
            startSignal.await();
            System.out.println("runnable do things");
            doneSignal.countDown();
        }catch (InterruptedException e){

        }
    }
}
